package com.adv.ems.model.vo;

import lombok.Data;

@Data
public class ResultVO<T> {
    private int code;
    private String msg;
    private String developMsg;
    private T content;

    public static <T> ResultVO<T> success(T t) {
        ResultVO<T> vo = new ResultVO<T>();
        vo.setCode(200);
        vo.setContent(t);
        return vo;
    }

    public static <T> ResultVO<T> success() {
        ResultVO<T> vo = new ResultVO<T>();
        vo.setCode(200);
        return vo;
    }

    public static <T> ResultVO<T> error(String msg) {
        ResultVO<T> vo = new ResultVO<T>();
        vo.setCode(500);
        vo.setMsg(msg);
        return vo;
    }

    public static <T> ResultVO<T> error() {
        ResultVO<T> vo = new ResultVO<T>();
        vo.setCode(500);
        return vo;
    }

    public boolean isSuccess() {
        return code == 200;
    }
}
